//     https://ac.nowcoder.com/acm/contest/11163/C




#include <iostream>
using namespace std;

int f(int x)
{
    int ans = 0, a = 1;
    while (x != 0)
    {
        x -= a;
        ans++;
        if (x % (a * 2) == 0)
            a *= 2;
    }
    return ans;
}

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int h;
        cin >> h;
        cout << f(h) << endl;
    }
    return 0;
}